<template>
    <div>
        <div class="fotbox" v-if="!islogin">
            <router-link to="/login" class="item">登录</router-link>
            <router-link to="/login" class="item">注册</router-link>
            <div class="item">触屏版</div>
            <div class="item">电脑版</div>
        </div>
        <div v-else class="fotbox">
            <div class="item"><div class="bord">{{message.username}}</div></div>
            <div class="item" @click="tuichu">退出</div>
            <div class="item">触屏版</div>
            <div class="item">电脑版</div>
        </div>
        <div id="np">
            <div class="nptext">
                <div class="lineone">
                    <p>All Rights Reserved©2011-2017 </p>
                    <p class="teshu">APP下载</p>
                </div>
                <p>沪ICP备12027781号| 沪公网备 310104031210</p>
                <p>客服电话400-161-1788</p>
            </div>

        </div>

    </div>
</template>

<script>
import {Toast} from 'mint-ui'
export default {
    data: function() {
        return {
            islogin:false,
            message:{}
        }
    },
    mounted(){
       this.http.post("/api/islogin")
       .then(res=>{
           if(res.data.isLogin.isLogin){
                this.islogin = true;
                this.message = res.data.isLogin.data;
           }else{
               this.islogin = false;
           }    
       }) 
    },
    methods: {
        tuichu:function(){
            this.http.post("/api/tuichu")
            .then(res=>{
                // console.log(res.data);
                if(res.data.err == "0"){
                        Toast({
                            message: res.data.msg,
                            position: 'middle',
                            duration: 1000
                        });
                    }
                window.location.href = "/";
            })
        }
    }
}
</script>

<style scoped>
a{
    text-decoration: none;
}
.fotbox {
    width: 100%;
    height: 40px;
    /*border: solid 1px black;*/
    display: flex;
}
.bord{
    margin-left: 12%;
    width: 60%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.item {
    width: 25%;
    height: 40px;
    text-align: center;
    line-height: 40px;
    font-size: 12px;
    color: gray;
}

p {
    margin: 0;
    font-size: small;
    color: rgb(102, 102, 102);
}

#np {
    width: 100vw;
    height: 100px;
}

.lineone {
    display: flex;
    justify-content: space-around;
    height: 20px;
    line-height: 20px;
}

.nptext {
    width: 90vw;
    margin: 0 auto;
    text-align: center;
}

.teshu {
    color: rgb(255, 0, 0);
    font-family: Arial;
    font-size: 17px;
}
</style>